package com.zhao.dota.model;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Data;

import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.Objects;

@Data
public class Quotation implements Serializable, Comparable<Quotation> {

    @TableId(type = IdType.AUTO)
    private Integer id;

    private Integer leagueId;

    private Integer roundId;

    private Integer userId;

    private Integer heroId;

    private String heroName;

    private String heroLocalizedName;

    private Integer gold;

    private Integer point;

    private LocalDateTime time;

    private Integer target;

    private Boolean succeed;

    @Override
    public int compareTo(Quotation o) {
        if (o == null) {
            return 1;
        }
        if (!this.gold.equals(o.gold)) {
            return this.gold.compareTo(o.getGold());
        }
        if (!Objects.equals(this.point, o.point)) {
            return this.point.compareTo(o.point);
        }
        return 0;
    }
}
